home *** CD-ROM | disk | FTP | other *** search
- FastKey v1.1 for Turbo Pascal 6.0
- FastKey v1.0 for Turbo C
- Copyright 1992 by Steve Holley.
-
- Opening Rambling:
- While writing my first arcade game for the IBM PC, I discovered that
- the standard keyboard routines that I had available were not good
- enough. I needed a method to handle the key presses as soon as the
- program was ready for them. There was also a slight delay that
- occurred when you switch between keys that you have been holding
- down. After much coding and research, I developed a routine that
- would monitor the keyboard with enough speed to please me. At the
- suggestion of a good friend, and since I was unable to find a similar
- product while developing my code (that would have saved me a lot of
- time), I have decided to release a unit for Turbo Pascal 6.0 that
- improves keyboard handling. Special thanks to Curtis Keisler for the
- conversion of the assembler code to a Turbo Pascal Unit and for his
- suggestions.
-
- What FastKey is:
- FastKey is an interrupt driven routine that monitors the keyboard,
- keeping track of which keys are pressed and which are not. At any
- given time you can check to see which keys are pressed since the
- interrupt occurs asynchronous to the rest of your program. This may
- sound strange but for arcade games it is a good way of handling the
- keyboard. It allows the program to process keyboard input as soon as
- the program is ready for it. I do not recommend this routine for
- standard business applications since it does not buffer the input or
- process the keyboard in the same way that the normal interrupt does.
- Also, any TSR (Terminate and Stay Resident) programs that use the
- keyboard interrupt will not work with FastKey. In general, as soon
- as you install FastKey your program has the whole computer to itself.
- As soon as FastKey is removed, the TSRs will work properly. While
- FastKey is installed the following Turbo Pascal procedures and
- functions should not be used: Readln, KeyPressed and ReadKey. If you
- attempt to uses these routines the computer may lock-up.
-
- Disclaimer:
- I wish that I did not have to include this section but due to the
- highly "sue-able" state of the world, the following section is,
- unfortunately, required. FastKey is distributed "as is", with no
- guarantee that it will work properly in any or all programs or
- combinations of hardware. The Author assumes no liability for any
- damages, financial, software or hardware, caused by the use, misuse,
- or modification of this product, nor is he liable if part of a
- passing 747 falls on your house destroying your computer while using
- this product.
-
- Distribution:
- You may freely distribute unmodified copies of the FastKey package
- (all files listed in the README file) so long as any fee charged is
- for distribution costs only. Commercial distribution strictly
- prohibited.
-
- System Requirements:
- 1. IBM PC/XT/AT/Jr/PS/2 or 100%
- 2. Turbo Pascal(tm) v6.0 or greater
-
- Turbo Pascal and Turbo C are registered trademarks of BORLAND International.
- Compuserve is a registered trademark of Compuserve Incorporated. Usage:
- FastKey is easy to use. To make it available to your program just
- include FastKey in your Uses section at the start of your program.
- See the Turbo Pascal reference manual for help with the Uses command.
- Only four routines are used in the FastKey unit. Each is detailed
- below. For an example of how to use FastKey, examine DEMO2.PAS.
-
- Procedure InstallFastKey;
- Function FastKeyInstalled : Boolean;
- Function Pressed (KeyCode : Byte) : Boolean;
- Function FastKeyPressed : Boolean;
- Procedure UnInstallFastKey;
-
- InstallFastKey
- Before FastKey can be used, it must first be installed. At the start
- of your program, call InstallFastKey. I recommend that you do this
- in your main program block or in your initialization routine. That's
- all there is to the installation. As soon as it is installed you can
- begin to use Pressed to determine which keys are pressed.
-
- FastKeyInstalled
- The function FastKeyInstalled is used to determine if FastKey has
- been installed. It will return true if FastKey has been installed.
- You probably will not use it but it is there if you need it.
-
- Pressed(KeyCode)
- Pressed will return a boolean value indicating the status of any key
- on the keyboard. See Key Code Table at the end of this document for
- a list of each of the keys and their key code. A value of TRUE
- indicates that the key is pressed. A value of FALSE means it is not.
- Note that any combination of keys may be checked by successive calls
- to pressed. For example to determine if both Cursor Up and Cursor
- Left are pressed use the following line:
-
- IF Pressed(FKUP) AND Pressed(FKLEFT) THEN some action
-
- Several useful key combinations are possible by combining boolean
- expressions with Pressed. It is also possible to check that a key is
- not pressed at the same time as another key is pressed. If the
- cursor left and right controlled a ships movement on screen, you
- would not want to be able to move if both keys were pressed. The
- following lines move the ship and insure that only legal key
- combinations are allowed.
-
- IF Pressed(FKLEFT) AND NOT Pressed(FKRIGHT) THEN move left
- IF Pressed(FKRIGHT) AND NOT Pressed(FKLEFT) THEN move right
-
- FastKeyPressed
- The function FastKeyPressed is used to see if any key is currently
- pressed, perhaps to see if there is a need to check for an complex
- key combination. It is used exactly the same as the Turbo Pascal
- function Keypressed.
-
- UnInstallFastKey
- It is very important that you remove FastKey from the interrupt table
- before you exit your program. Failure to do so will result in your
- computer locking up so tightly that you will have to use the big red
- button to bring it back to life. This should be one of the last
- instructions executed, perhaps in the main program block or a routine
- that resets the computer. Registration:
- FastKey is distributed as shareware. The registration fee for
- continued use of the unit is proper credit. If you use these
- routines in a program, please include something like "FASTKEY
- Keyboard Routines by Steve Holley" in the title screen or
- documentation, and just drop me a note at the following address. I'd
- like to see what people have been able to do with these routines. If
- you would like to make a contribution to the author for the use of
- the unit, any amount will be accepted (and is encouraged if you
- charge a fee for your software that uses FastKey. You decide what is
- fair since only you know how important these routines were to your
- program.).
-
- All source code is available for $20.00. This includes the original
- .ASM file, an .OBJ file compiled with Borland TASM 2.0 (the best
- assembler on the market), the source code for the Turbo Pascal Unit
- that you already have and the C source code for FastKey, and the
- source & executable for a program to display the key codes generated
- by the keyboard. All source code is heavily commented to make
- modification and understanding easier. The source code will come in
- handy if/when TP 7.0 comes out and the unit formats are again
- changed, or you want to add support for a new or non-standard
- keyboard. With the assembler source code it should be possible to
- add these routines to any programming language. To receive the
- source, send a check for $20.00 made payable to Steve Holley to:
-
- Steve Holley
- Rt. 1 Box 210-W-1
- Barnwell, SC 29812.
-
- Please specify the disk size that you would like and allow 2-4 weeks
- for delivery.
-
- Contacting me:
- I may be reached at the above address for questions or comments about
- FastKey. I also visit the Gamers forum on Compuserve(tm) frequently.
- Leave mail for 76424,1521. This is the fastest way to reach me if
- you have any trouble using FastKey or have any questions about it. Key Code Listing
-
- Key________ Code_________ Key________ Code_________
- Esc FKEsc CapsLock FKCapsLock
- F1 FKF1 A FKA
- F2 FKF2 S FKS
- F3 FKF3 D FKD
- F4 FKF4 F FKF
- F5 FKF5 G FKG
- F6 FKF6 H FKH
- F7 FKF7 J FKJ
- F8 FKF8 K FKK
- F9 FKF9 L FKL
- F10 FKF10 ; FKSemiColon
- F11 FKF11 ' FKRQuote
- F12 FKF12 Enter FKEnter
- Print Screen FKPrtSc
- Scroll Lock FKScrollLock Left Shift FKLShift
- Z FKZ
- ` FKLQuote X FKX
- 1 FK1 C FKC
- 2 FK2 V FKV
- 3 FK3 B FKB
- 4 FK4 N FKN
- 5 FK5 M FKM
- 6 FK6 , FKComma
- 7 FK7 . FKPeriod
- 8 FK8 / FKFSlash
- 9 FK9 Right Shift FLRShift
- 0 FK0
- - FKMinus Ctrl FKCtrl
- = FKEqual Alt FKAlt
- Back Space FKBkSp Space FKSpace
-
- Tab FKTab
- Q FKQ NUMERIC KEYPAD
- W FKW
- E FKE FKNumLock
- R FKR FKKP7 FKKP8 FKKP9 FKKPMinus
- T FKT FKKP4 FKKP5 FKKP6 FKKPPlus
- Y FKY FKKP1 FKKP2 FKKP3
- U FKU FKKP0 FKKPPeriod
- I FKI
- O FKO CURSOR CONTROL
- P FKP
- [ FKLBracket FKUpLeft FKUp FKUpRight
- ] FKRBracket FKLeft FKCenter FKRight
- \ FKBSlash FKDownLeft FKDown FKDownRight
-
-
- Notes about the Key Code Table:
- The naming convention for the key codes is as follows: FK + Key
- Name. For example, the key code for the left bracket is FKLBracket
- (FK for FastKey, L for Left, and then Bracket).
-
- It is not necessary to have a key code for all the labels on the
- keyboard. Keys that have multiple labels are identified by the
- primary label for that key. If you want to explicitly check for one
- of these labels you will have to check the Shift, Ctrl, and Alt status yourself. See the description of Pressed above for an example
- of detecting multiple keys pressed.
-
- Due to the way some keyboards are designed, different keys may create
- the same key codes. On the AT Keyboard with 101 keys both Cursor Up
- and 8 on the numeric keypad generate the same key code while the
- number 8 above the alphabetic keys does not create the same key code
- as the 8 on the keypad.
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- Public (software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. PsL cannot debug pro-
- programs over the telephone, though we can answer questions.
-
- Disks in the PsL are updated monthly, so if you did not get
- this disk directly from the PsL, you should be aware that the
- files in this set may no longer be the current versions. Also,
- if you got this disk from another vendor and are having prob-
- lems, be aware that some files may have become corrupted or
- lost by that vendor. Get a current, working disk from PsL.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 4,000+ disks in the library, call or write
-
- Public (software) Library
- P.O.Box 35705
- Houston, TX 77235-5705
-
- Orders only:
- 1-800-2424-PSL
- MC/Visa/AmEx/Discover
-
- Outside of U.S. or in Texas
- or for general information,
- Call 1-713-524-6394